package com.wphmoon.lesson.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.wphmoon.lesson.domain.MyTask;
import com.wphmoon.lesson.domain.MyUser;
import com.wphmoon.lesson.mapper.MyTaskMapper;
import com.wphmoon.lesson.mapper.MyUserMapper;

@RestController
@RequestMapping("/my")
public class MyController {
	
	@Autowired
	private MyTaskMapper myTaskMapper;
	@Autowired
	private MyUserMapper myUserMapper;
	
	//http://localhost:8080/my/insert2MyTask?title=test2&userId=2
	@RequestMapping(path="/insert2MyTask")
	public String insert2MyTask(MyTask myTask) {
		return String.valueOf(myTaskMapper.insert(myTask));
	}
	
	//http://localhost:8080/my/insert2MyUser?name=test2&age=2
	@RequestMapping(path="/insert2MyUser")
	public String insert2Myuser(MyUser myUser) {
		myUserMapper.insert(myUser);
		return "";
	}

}
